<div class="bjui-pageContent">
    <form action="{:url('Rule/add')}" class="pageForm" data-toggle="validate" method="post">
        <div class="pageFormContent" data-layout-h="0">
            <table class="table-bordered table-condensed table-hover" width="100%">
                <tbody>
                <tr>
                    <td style="padding:5px 0px;">
                        <label for="j_module" class="control-label x85">归属模块：</label>
                        <select name="module_id" onchange="rasp(this)" id="j_module" data-toggle="selectpicker" data-width="116">
                            {volist name="mArr" id="row1"}
                            <optgroup label="{$key}">
                                {volist name="row1" id="row"}
                                <option value="{$row.id}">&nbsp;|-{$row.title}</option>
                                {/volist}
                            </optgroup>
                            {/volist}
                        </select>
                        <select id="j_rule_ac" onchange="ratt(this)" data-toggle="selectpicker" data-width="120">
                            {volist name="sonArr" id="row1"}
                            {eq name="$i" value="1"}
                            {volist name="row1" id="row"}
                            <option value="{$row.module}">{$row.title}</option>
                            {/volist}
                            {/eq}
                            {/volist}
                        </select>
                        {volist name="sonArr" id="row1"}
                        <div id="module_option_{$key}" style="display:none;">
                            {volist name="row1" id="row"}
                            <option value="{$row.module}">{$row.title}</option>
                            {/volist}
                        </div>
                        {/volist}
                    </td>
                </tr>
                <tr>
                    <td style="padding:5px 0px;">
                        <label for="j_title" class="control-label x85">规则名称：</label>
                        <input type="text" name="title" id="j_a_title" value="" data-rule="required;title;remote[{:url('Rule/same')}]" size="24">
                    </td>
                </tr>
                <tr>
                    <td style="padding:5px 0px;">
                        <label for="j_name" class="control-label x85">认证规则：</label>
                        <input type="text" name="name" id="j_a_name" value="" data-rule="required;name;remote[{:url('Rule/same')}]" size="24">
                    </td>
                </tr>
                <tr>
                    <td style="padding:5px 0px;height:35px;">
                        <label for="" class="control-label x85">高级认证：</label>
                        <input type="radio" name="type" id="j_lock1" data-toggle="icheck" value="1" checked data-label="否&nbsp;&nbsp;">
                        <input type="radio" name="type" id="j_lock2" data-toggle="icheck" value="0" data-label="是">
                    </td>
                </tr>
                <tr>
                    <td style="padding:5px 0px;height:35px;">
                        <label for="" class="control-label x85">可用状态：</label>
                        <input type="radio" name="status" id="j_status1" data-toggle="icheck" value="1" checked data-label="正常&nbsp;&nbsp;">
                        <input type="radio" name="status" id="j_status2" data-toggle="icheck" value="0" data-label="禁用">
                    </td>
                </tr>
                <tr>
                    <td style="padding:5px 0px;">
                        <label for="j_condition" class="control-label x85">正则规则：</label>
                        <textarea name="condition" id="j_condition" data-toggle="autoheight" cols="24" rows="2"></textarea>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="undo">取消</button></li>
        <li><button type="submit" class="btn-green" data-icon="save">保存</button></li>
    </ul>
</div>
<script type="text/javascript">
    function rasp(obj){
        var mid = $(obj).val();
        //$('#j_rule_ac').html($('#module_option_'+mid).html()).selectpicker('refresh');
        $('#j_rule_ac').selectpicker('destroy').html($('#module_option_'+mid).html()).selectpicker('render');
        ratt($('#j_rule_ac'));
    }
    function ratt(obj){
        var module = $(obj).val();
        $('#j_a_title').val($(obj).find('option:selected').text());
        $('#j_a_name').val('Admin/'+module+'/');
    }
</script>